package study.concurrent.thread.support.runner;

import cn.hutool.core.thread.ThreadUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 *
 */
@Slf4j
@Component
public class ThreadRunner implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {

        int counter = 0;
        Thread t = ThreadUtil.newThread(() -> {
            while (true) {
//                counter++;
                ThreadUtil.sleep(5 * 1000);
                log.info(" sleep");

            }
        }, "My-Custom-Thead");
        t.start();
    }
}
